package demo01;

public class Chengxu40 {
    public static void main(String[] args) {
        String[] strArr = {"apple", "banana", "cherry", "date", "fig"};
        
        for (int i = 0; i < strArr.length - 1; i++) {
            for (int j = 0; j < strArr.length - 1 - i; j++) {
                if (strArr[j].compareTo(strArr[j + 1]) > 0) {
                    String temp = strArr[j];
                    strArr[j] = strArr[j + 1];
                    strArr[j + 1] = temp;
                }
            }
        }
        
        for (String str : strArr) {
            System.out.println(str);
        }
    }
}

